import Vue from 'vue';
import VProgressBar from './v-progress-bar';

let Instance = null;

const create = (component, props) => {
  if (Instance) return;
  const Bar = Vue.extend(VProgressBar);
  const vm = new Bar({ props });

  Instance = vm;

  document.body.appendChild(vm.$mount().$el);
};

export default {
  start() {
    create(VProgressBar, {});
    Instance.start();
  },
  error() {
    Instance.error();
  },
  done() {
    Instance.done();
  },
};

